package com.ds.service;

import com.ds.orm.model.SysEvent;
import com.baomidou.mybatisplus.plugins.Page;
import com.ds.core.base.BaseService;
import com.ds.service.UserService;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Du
 * @since 2018-01-09
 */
@Service
public class SysEventService extends BaseService<SysEvent>{
	@Autowired
	private UserService sysUserService;

	@Override
	public Page<SysEvent> query(Map<String, Object> params) {
		Page<SysEvent> page = super.query(params);
		for (SysEvent sysEvent : page.getRecords()) {
			Long createBy = sysEvent.getCreateBy();
			if (createBy != null) {
				sysEvent.setUserName(sysUserService.queryById(createBy).getUserName());
			}
		}
		return page;
	}
}
